package com.stu.action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.stu.service.StuService;
import com.stu.service.impl.StuServiceImpl;

/**
 * Servlet implementation class StuDeleteAction
 */
@WebServlet("/StuDeleteAction")
public class StuDeleteAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
    public StuDeleteAction() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		request.setCharacterEncoding("utf-8");
		String id=request.getParameter("id");
		StuService service=StuServiceImpl.getStuServiceImpl();
		if(service.delete(id)) {
			request.getRequestDispatcher("StuViewAction")
			.forward(request, response);
		}else {
			System.out.println("删除失败！");
		}
	}
}
